﻿<%@ Page Language="C#" MasterPageFile="../../MasterPage.Master" AutoEventWireup="true" CodeBehind="ICM_Asset_Register.aspx.cs" Inherits="KPIS.GERP.GIMS.APP.APP_UI.Form.ICM_Asset_Register" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="server">
      <script type="text/javascript">
              function onTextChangeGeneral(sender) {
                  if (sender.get_value() == "") {
                      sender.set_text("");
                  }
              }
              function openAssetDetail(asset_code)
              {
                    radopen("../Edit_Form/ICM_Asset_Register.aspx"+ "?asset_code="+asset_code ,"WindowDetail");     
              }
               function closeRadWindow(sender, args) 
              {
                   $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();
               }
               function CollapsePane() {
                   var slidingZone = $find("<%= SlidingZone1.ClientID %>");
                   var panes = slidingZone.GetPanes();
                   slidingZone.collapsePane(panes[1].get_id());
               }
      </script>        
      <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
                    <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="grdAsset" LoadingPanelID="RadAjaxLoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                        <telerik:AjaxSetting AjaxControlID="grdAsset">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="grdAsset" LoadingPanelID="RadAjaxLoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                        <telerik:AjaxSetting AjaxControlID="btnShow">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="grdAsset" LoadingPanelID="RadAjaxLoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>
      </telerik:RadAjaxManager>   
    <telerik:RadSplitter id="RadSplitter1" runat="server" height="460" width="1000" Skin="Office2007" ResizeMode="EndPane">
        <telerik:RadPane id="LeftPane" runat="server" width="22" Scrolling="None" Locked="true" >
            <telerik:RadSlidingZone id="SlidingZone1" runat="server" width="22" ClickToOpen="true" EnableViewState="true">
                <telerik:RadSlidingPane id="PaneSearch" title="กรองข้อมูล" runat="server" width="400" IconUrl="../Image/Tree/search.gif" EnableDock="false">
                    <asp:Panel ID="PanelPaneSearch" runat="server">
                        <table width="100%" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="10px">
                                </td>
                                <td>
                                    <div class="bigModuleLeftTree">
                                        <div class="bigModuleBottomLeftTree">
                                            <div class="header-grid">
                                                <asp:Label ID="lblHeaderPurchaseType" runat="server" Text="กรองข้อมูล"></asp:Label>
                                            </div>
                                            <asp:Panel CssClass="panelTree" ID="PanelSearch" runat="server" ScrollBars="Auto">
                                                <table cellpadding="2" cellspacing="5" width="100%" class="font-label">
                                                    <tr>
                                                        <td width="50px">
                                                        </td>
                                                        <td width="100%">
                                                            <table width="100%">
                                                                <tr>
                                                                    <td width = "100px">
                                                                        ประเภทปี :
                                                                    </td>
                                                                    <td width="150px">
                                                                        <telerik:RadComboBox CssClass="RadComboBox" runat="server" ID="cbYearType" AllowCustomText="true" ShowDropDownOnTextboxClick="true"
                                                                            Filter="Contains" DataTextField="Name" DataValueField="Seq" Width="150px" 
                                                                            EmptyMessage=".. พิมพ์ที่นี่เพื่อช่วยค้นหา .." LoadingMessage="กำลังโหลดข้อมูล ..." MarkFirstMatch="false" 
                                                                            OnClientTextChange="onTextChangeGeneral" ValidationGroup="ValSearch">
                                                                        </telerik:RadComboBox>
                                                                    </td>
                                                                    <td>
                                                                        <label id="Label1" runat="server"><font color="red">*</font></label>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                    </td>
                                                                    <td colspan="2">
                                                                        <asp:RequiredFieldValidator ID="ValcbYearType" runat="server" ControlToValidate="cbYearType" SetFocusOnError="True" Display="Dynamic" ErrorMessage="* กรุณาระบุประเภทปี *" ValidationGroup="ValSearch"></asp:RequiredFieldValidator>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                        </td>
                                                        <td>
                                                            <table width="100%">
                                                                <tr>
                                                                    <td width = "100px">
                                                                        ปี :
                                                                    </td>
                                                                    <td>
                                                                        <telerik:RadNumericTextBox ID="txtYear" Runat="server" Width="100px" Skin="Outlook" NumberFormat-GroupSeparator="" NumberFormat-DecimalDigits="0" ValidationGroup="ValSearch"></telerik:RadNumericTextBox>
                                                                        <label id="Label2" runat="server"><font color="red">*</font></label>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                    </td>
                                                                    <td>
                                                                        <asp:RequiredFieldValidator ID="ValtxtYear" runat="server" ControlToValidate="txtYear" SetFocusOnError="True" Display="Dynamic" ErrorMessage="* กรุณาระบุปี *" ValidationGroup="ValSearch"></asp:RequiredFieldValidator>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                    
                                                </table>
                                                <br />
                                                <div align="center">
                                                    <asp:Panel ID="panelShow" runat="server">
                                                        <asp:LinkButton CssClass="button-next-background" ID="btnShow" runat="server" Text="แสดงข้อมูล" onclick="btnShow_Click" OnClientClick="CollapsePane();" ValidationGroup="Select"></asp:LinkButton>
                                                    </asp:Panel>
                                                </div>
                                            </asp:Panel>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </telerik:RadSlidingPane>
            </telerik:RadSlidingZone> 
        </telerik:RadPane>
        <telerik:RadSplitBar id="RadSplitBar1" runat="server" Visible="false"></telerik:RadSplitBar>
        
        <telerik:RadPane id="PaneData" runat="server" Scrolling="None">
            <div class="bigModulePaneFull">
            <div class="bigModuleBottomPaneFull">
                    <asp:Panel ID="Panel1" runat="server" CssClass="contentPaneDiv" ScrollBars="Auto" align = "center" >    
                       <div class="header-grid" align="left">
                            <asp:Label ID="Label4" runat="server" Text="ข้อมูลพัสดุ"></asp:Label>
                       </div>
                    </asp:Panel>
                           <table align = "center">
                              <tr>
                                 <td>
                                    <asp:Panel CssClass="panelGrid" Width="950px" Height="350px" ID="panelGrid" runat="server" ScrollBars="Auto" Visible="true" >
                                        <telerik:RadGrid ID="grdAsset" 
                                            runat="server" 
                                            AutoGenerateColumns="false"
                                            AllowMultiRowEdit="false" 
                                            AllowMultiRowSelection="true" 
                                            ShowStatusBar="true"
                                            Width="930px" Height="330px" 
                                            AllowPaging="true" 
                                            AllowFilteringByColumn="false"
                                            GroupingSettings-GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;"
                                            GroupingSettings-GroupContinuedFormatString=""
                                            GroupingSettings-GroupContinuesFormatString=""
                                            GroupingSettings-GroupSplitFormat="" PageSize ="7" 
                                            OnNeedDataSource="grdAsset_NeedDataSource" align ="left">
                                            <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1" GroupLoadMode="Client"
                                                ShowGroupFooter="true" 
                                                DataKeyNames="asset_code" NoMasterRecordsText="< ไม่มีข้อมูล >" GroupsDefaultExpanded="true">
                                                <RowIndicatorColumn>
                                                    <HeaderStyle Width="20px" />
                                                </RowIndicatorColumn>
                                                <ExpandCollapseColumn>
                                                    <HeaderStyle Width="20px" />
                                                </ExpandCollapseColumn>
                                                <Columns>   
                                                    <telerik:GridTemplateColumn DataField="asset_code" 
                                                        HeaderText="รหัสพัสดุที่เกิดจากการรับเข้า" ShowFilterIcon="false" 
                                                        HeaderStyle-Font-Bold="true"
                                                        HeaderStyle-HorizontalAlign="Center" 
                                                        ItemStyle-HorizontalAlign = "Left"
                                                        FilterControlWidth="100%" UniqueName="asset_code" HeaderStyle-Width="155px">
                                                        <ItemTemplate >                                                                                                                           
                                                            <asp:LinkButton ID="tgcAssetCode" runat="server" Text='<%# Eval("asset_code") %>' 
                                                                OnClientClick='<%# string.Format("return openAssetDetail(\"{0}\");", Eval("asset_code")) %>'  > 
                                                            </asp:LinkButton>
                                                        </ItemTemplate>
                                                    </telerik:GridTemplateColumn>
                                                    <telerik:GridTemplateColumn DataField="asset_name" 
                                                        HeaderText="ชื่อพัสดุ" ShowFilterIcon="false" 
                                                        HeaderStyle-Width="300px"
                                                        HeaderStyle-Font-Bold="true" 
                                                        HeaderStyle-HorizontalAlign="Center" 
                                                        ItemStyle-HorizontalAlign = "Left"
                                                        FilterControlWidth="100%" UniqueName="asset_name">
                                                        <ItemTemplate >                                                                                                                           
                                                            <asp:LinkButton ID="tgcAssetName" runat="server" 
                                                                Text='<%# Eval("asset_name") %>' 
                                                                OnClientClick='<%# string.Format("return openAssetDetail(\"{0}\");", Eval("asset_code")) %>'  > 
                                                            </asp:LinkButton>
                                                        </ItemTemplate>
                                                    </telerik:GridTemplateColumn>
                                                    <telerik:GridBoundColumn DataField="icm_receive_code" 
                                                        HeaderText="รหัสการรับเข้า" UniqueName="icm_receive_code"
                                                        FilterControlWidth="100%" AutoPostBackOnFilter="true"
                                                        CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                                                        ItemStyle-HorizontalAlign = "Left"
                                                        HeaderStyle-Width="155px"
                                                        HeaderStyle-Font-Bold="true" 
                                                        HeaderStyle-HorizontalAlign="Center">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="receive_date" 
                                                        HeaderText="วันที่รับเข้าพัสดุ" UniqueName="receive_date" DataFormatString = "{0:D}"
                                                        FilterControlWidth="100%" AutoPostBackOnFilter="true"
                                                        CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                                                        ItemStyle-HorizontalAlign = "Left"
                                                        HeaderStyle-Width="130px"
                                                        HeaderStyle-Font-Bold="true" 
                                                        HeaderStyle-HorizontalAlign="Center">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="price" 
                                                        DataFormatString="{0:N2}"
                                                        HeaderText="ราคา" UniqueName="price" 
                                                        FilterControlWidth="100%" AutoPostBackOnFilter="true"
                                                        CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                                                        ItemStyle-HorizontalAlign = "Right"
                                                        HeaderStyle-Width="122px"
                                                        HeaderStyle-Font-Bold="true" 
                                                        HeaderStyle-HorizontalAlign="Center">
                                                    </telerik:GridBoundColumn>
                                                </Columns>
                                                <PagerStyle Mode="NumericPages" AlwaysVisible="true" 
                                                    FirstPageToolTip="กลับหน้าแรก" LastPageToolTip="ไปหน้าสุดท้าย" 
                                                    NextPagesToolTip="หน้าถัดไป" NextPageToolTip="หน้าถัดไป" 
                                                    PrevPagesToolTip="ย้อนกลับ" PrevPageToolTip="ย้อนกลับ" />
                                                </MasterTableView>
                                            <GroupingSettings GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;" 
                                                GroupContinuedFormatString="" GroupContinuesFormatString="" 
                                                GroupSplitFormat="" />
                                            <ClientSettings EnableRowHoverStyle="True">
                                                <Selecting AllowRowSelect="true" />
                                                <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                                            </ClientSettings>
                                        </telerik:RadGrid> 
                                    </asp:Panel>
                                 </td>
                             </tr>
                         </table>    
                 
              </div>
        </div> 
    </telerik:RadPane>
</telerik:RadSplitter>   
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" >
    <Windows>
        <telerik:RadWindow ID="WindowDetail" runat="server" Width="1016px" Height="590px"
            showcontentduringload="false"  VisibleStatusbar="false"
            Modal="true" Skin = "Vista" behaviors="Close"
            title="แสดงรายละเอียดเกี่ยวกับพัสดุ" 
            OnClientClose="closeRadWindow" >
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>                                                             
</asp:Content>
